<?php
include 'secure/core.php';
$SQL = "SELECT * FROM `settings`";
$res = $ado->exec($SQL);
$row	=	$ado->fetch($res);
?>
<?php 
if(isset($_POST['submit'])){
$uploaddir = '../gfx';
$tmp_name = $_FILES["userfile"]["tmp_name"];
$name = '/logo.png';
$uploadfile = $uploaddir . $name;
if(isset($_FILES['userfile'])){
move_uploaded_file($tmp_name, "$uploadfile");
$query = "UPDATE `settings` SET `site_logo` = '$uploadfile'";
$result = mysql_query($query);
header( 'Location: change_logo.php?msg=1' ) ;
} else {
header( 'Location: change_logo.php?msg=2' ) ;
}
}
include 'header.php';
include 'left.php'; 
?>

		<div id="right">
		<div class="section">
		<?php if($_GET['msg'] == '1') { ?>
		<div class="message green"><span><b>Success</b>: Logo has been successfully updated.</span></div>
		<?php } ?>
		<?php if($_GET['msg'] == '2') { ?>
		<div class="message red"><span><b>Error</b>: Error updating current logo.</span></div>
		<?php } ?>
				<div class="box">
					<div class="title">
						Change Logo
						<span class="hide"></span>
					</div>
					<div class="content">
						<form action="change_logo.php" method="POST" enctype="multipart/form-data">
							<div class="row">
								<label>Select Logo</label>
								<div class="right"><input type="file" name="userfile" id="userfile"></div>
							</div>
							<div class="row">
								<div class="right">
								<button type="submit" class="green" name="submit"><span>Update</span></button>
								</div>
							</div>
						</form>
					</div>
				</div>
				<div class="box">
					<div class="title">
						Current Logo
						<span class="hide"></span>
					</div>
					<div class="content">
							<div class="row">
								<div class="center"><center><img src="<?php echo $row['site_logo']; ?>"></center></div>
							</div>
					</div>
				</div>
			</div>
		</div>

<div id="footer">
			<div class="split">Copyright &#169; 2012 - <?php echo $file_path.$file_name; ?> <a href="index.php">Paid4Upload</a>.</div>
			<div class="split right"><a href="http://www.paid4upload.com/forums">Forums</a> | <a href="tos.php">Terms of Service</a> | <a href="dmca.php">DMCA</a></div>
		</div>
	</div>
</div>

</body>


</html> 